/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.account.Key.ServerBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.AttributeCallback.MultiValueMod;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MailHostPool
/*    */   extends AttributeCallback
/*    */ {
/*    */   public void preModify(CallbackContext context, String attrName, Object value, Map attrsToModify, Entry entry)
/*    */     throws ServiceException
/*    */   {
/* 40 */     AttributeCallback.MultiValueMod mod = multiValueMod(attrsToModify, "zimbraMailHostPool");
/*    */     Provisioning prov;
/* 42 */     if ((mod.adding()) || (mod.replacing())) {
/* 43 */       prov = Provisioning.getInstance();
/* 44 */       List<String> pool = mod.values();
/* 45 */       for (String host : pool) {
/* 46 */         if ((host != null) && (!host.equals(""))) {
/* 47 */           Server server = prov.get(Key.ServerBy.id, host);
/* 48 */           if (server == null) {
/* 49 */             throw ServiceException.INVALID_REQUEST("specified zimbraMailHostPool does not correspond to a valid server: " + host, null);
/*    */           }
/*    */           
/*    */ 
/* 53 */           if (!server.hasMailClientService()) {
/* 54 */             throw ServiceException.INVALID_REQUEST("specified zimbraMailHost is not a mailclient server with service webapp enabled: " + host, null);
/*    */           }
/*    */         }
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry) {}
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/MailHostPool.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */